#ifndef __DEVICE_MANAGER_H_INCLUDED__
#define __DEVICE_MANAGER_H_INCLUDED__

#include "IUnknown.h"
#include "IrrlichtDevice.h"
#include "irrThread.h"
#include "irrMonitor.h"

namespace irr
{
	namespace scene
	{
		class ISceneManager;
	}

	namespace video
	{
		class IVideoDriver;
	}
}

namespace game
{
	class IUserActionEventReceiver;
	
	namespace scene
	{
		class IGameSceneManager;
	}

	namespace video
	{
		class IVideoHandler;
	}

	namespace io
	{
		class IConfigReader;
	}

	//! This is the most important class of the game engine.You can access everything
	//! in the engine if you have a pointer to an instance of this class. 
	class IDeviceManager: public irr::IUnknown
	{
	private:
		static core::irrMonitor* IDeviceManager::videoLockerInstance()
		{
			static core::irrMonitor  instance;
			return &instance;
		}
	public:
		
		static void lockVideo()
		{
			IDeviceManager::videoLockerInstance()->enter();
		}

		static void unlockVideo()
		{
			IDeviceManager::videoLockerInstance()->exit();
		}

		//! Destructor
		virtual ~IDeviceManager() 
		{
		}

		virtual void stop() = 0;

		virtual void clearScreen() = 0;

		virtual IUserActionEventReceiver* getUserEventReceiver() = 0;

		virtual irr::gui::IGUIEnvironment* getGUIEnvironment() = 0;

		virtual irr::scene::ISceneManager* getSceneManager() = 0;

		virtual scene::IGameSceneManager* getGameSceneManager() = 0;

		virtual io::IConfigReader* getConfigReader() = 0;

		virtual irrThread* getVideoThread() = 0;

		virtual irr::IrrlichtDevice* getVideoDevice() = 0;

		virtual bool getIsVideoDeviceRun() = 0;

		//! Gets video handler for work with any video objects.
		virtual video::IVideoHandler* getVideoHandler() = 0;
	};
}
#endif
